{% comment %}
/* Copyright 2009 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
{% endcomment %}
{% extends 'base.html' %}
{% block content %}
  {% if do_import %}
  <div id="edit-message">
    {% if confirmation %}
      <div class="success">Feed successfully imported!</div>
    {% else %}
      <div class="warning">Warning, there were errors: {{ warnings }}</div>
    {% endif %}
  </div>
  {% endif %}

  {% if parsed_feed %}
    <h2>Feed title: {{parsed_feed.feed.title}}</h2>
    {% for entry in parsed_feed.entries%}
      <h3>Post Title: {{entry.title}}</h3>
      <div><b>Post Link:</b> {{entry.link}} </div>      
      {% if entry.feedburner_origlink %}<div><b>Non-Feedburner Link:</b> {{entry.feedburner_origlink}}</div>{% endif %}
      {% for contents in entry.content%}
        <p><b>Contents:</b> <div>{{contents.value}}</div></p>
      {% endfor %}
    {% endfor %}
    <form method="POST">
      <input type="hidden" name="author" value="{{user.key}}">
      <input type="hidden" name="feedURL" value="{{feedURL}}" />
      <input type="hidden" name="import_type" value="{{import_type}}" />
      <input type="submit" name="cancel" value="Cancel" />
      &nbsp;
      <input type="submit" name="do_import" value="Import Feed" />
    </form>    
  {% else %}
  <h3>Import an ATOM or RSS feed to become Posts or Pages</h3>
  <form method="POST">
    <input type="hidden" name="author" value="{{user.key}}">
    <p>URL of the feed:<br />
    <input type="text" size="75" name="feedURL" value="{{feedURL}}" />
    </p>
    <p>Import type: 
    <input type="radio" name="import_type" value="post" checked="checked" />Posts
    &nbsp;
    <input type="radio" name="import_type" value="pages" />Pages
    </p>
    <input type="submit" name="preview" value="Preview" />
    &nbsp;
    <input type="submit" name="do_import" value="I'm feeling lucky" />
  </form>
  {% endif %}
{% endblock %}